feat: add resilience patterns and event-driven observability#33
Merged
Conversation
sohankshirsagar
approved these changes
Jan 14, 2026
There was a problem hiding this comment.
3 issues found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="drift/core/tracing/adapters/api.py">
<violation number="1" location="drift/core/tracing/adapters/api.py:236">
P2: 4xx HTTP responses are retried even though they should fail fast, because `_do_export` raises the same generic `Exception` for both 5xx and 4xx, and `retry_async` retries on any `Exception`. Introduce a distinct non-retryable exception (or avoid raising) for 4xx responses so they fail immediately while keeping 5xx retryable.</violation>
</file>
<file name="drift/core/metrics.py">
<violation number="1" location="drift/core/metrics.py:270">
P2: `MetricsCollector.reset()` does not clear `_warned_*` flags, so post-reset anomalies never log warnings.</violation>
</file>
<file name="drift/core/batch_processor.py">
<violation number="1" location="drift/core/batch_processor.py:127">
P2: `_dropped_spans` is incremented outside the processor lock when a span is blocked, so concurrent calls can lose updates and under-report dropped spans.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds resilience and observability to the Python SDK's span export pipeline.
Changes
Resilience (
drift/core/resilience.py)SDK Metrics (
drift/core/metrics.py)get_sdk_metrics()for power usersAPI Adapter (
drift/core/tracing/adapters/api.py)Batch Processor (
drift/core/batch_processor.py)Cleanup
patch_instances_via_gc(expensivegc.get_objects()scan)Testing